package paginas;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.KeyEvent;
import java.util.ResourceBundle;

import javax.swing.ButtonGroup;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.border.TitledBorder;

import modelUtil.Configuracion;
import AccionBoton.AccionActivarPanelBarrido;

public class MenuConfigBarridoTab extends JPanel{



	private static final long serialVersionUID = 1L;
	private JRadioButton boton1;
	private JRadioButton boton2;
	private JComboBox desplegable;
	
	public MenuConfigBarridoTab() {


		initComponents();
		this.setPreferredSize(new Dimension(450,450));

	}
	
	public void initComponents(){
		
		
		GridLayout grid = new GridLayout(3,1);
		setLayout(grid);
		JPanel panel = panelTiempo();
		TitledBorder border = new TitledBorder(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_popup_config_barrido_titulo"));
		this.setBorder(border);

		JMenu menu = new JMenu();

		boton1 = new JRadioButton(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_popup_config_barrido_no"));
		boton1.addActionListener(new AccionActivarPanelBarrido(panel,false));
		boton1.setFocusable(true);
		boton1.setMnemonic(KeyEvent.VK_S);
		boton1.getAccessibleContext().setAccessibleName(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_accesible_deseleccion_barrido_general"));
		boton1.setToolTipText(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_accesible_deseleccion_barrido_general"));

		if(Configuracion.instancia().getBarrido().equals("No")){	boton1.doClick();
		boton1.setSelected(true);}
		grid.addLayoutComponent("menu",boton1);
		
		menu.add(boton1);
		add(boton1);
		
		boton2 = new JRadioButton(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_popup_config_barrido_si"));
		boton2.addActionListener(new AccionActivarPanelBarrido(panel,true));
		boton2.setFocusable(true);
		boton2.setMnemonic(KeyEvent.VK_O);
		boton2.getAccessibleContext().setAccessibleName(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_accesible_seleccion_barrido_general"));
		boton2.setToolTipText(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_accesible_seleccion_barrido_general"));
		if(Configuracion.instancia().getBarrido().equals("Si")){boton2.doClick();
		boton2.setSelected(true);
		}
		grid.addLayoutComponent("menu",boton2);
		menu.add(boton2);
		add(boton2);

		ButtonGroup bg = new ButtonGroup();
		bg.add(boton1);
		bg.add(boton2);
		add(panel);

	}
	
	public JPanel panelTiempo(){
		
		JPanel panel = new JPanel();
		GridLayout grid = new GridLayout(2,1);
		panel.setLayout(grid);
		JLabel titulo = new JLabel(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_popup_config_barrido_panel_tiempo"));
		grid.addLayoutComponent("titulo", titulo);
		panel.add(titulo);
		JPanel panel2 = new JPanel();
		grid.addLayoutComponent("panel", panel2);
		panel.add(panel2);
		desplegable = new JComboBox();
		desplegable.getAccessibleContext().setAccessibleName(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_accesible_desplegable_barrido_tiempo"));
		desplegable.setToolTipText(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_accesible_desplegable_barrido_tiempo"));
		desplegable.setFocusable(true);
		desplegable.setPreferredSize(new Dimension(80,30));
		panel2.add(desplegable);
		desplegable.addItem("0.25");
		desplegable.addItem("0.5");
		desplegable.addItem("0.75");
		desplegable.addItem("1");
		desplegable.addItem("1.5");
		desplegable.addItem("2");
		desplegable.addItem("3");
		desplegable.addItem("4");
		desplegable.addItem("5");
		desplegable.addItem("6");
		desplegable.addItem("7");
		desplegable.addItem("8");
		desplegable.addItem("9");
		desplegable.addItem("10");
		


		JLabel frase = new JLabel(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_popup_config_barrido_panel_tiempo_segundos"));
		panel2.add(frase);
		return panel;
	}

	public JRadioButton getBoton1() {
		return boton1;
	}

	public void setBoton1(JRadioButton boton1) {
		this.boton1 = boton1;
	}

	public JRadioButton getBoton2() {
		return boton2;
	}

	public void setBoton2(JRadioButton boton2) {
		this.boton2 = boton2;
	}

	public JComboBox getDesplegable() {
		return desplegable;
	}

	public void setDesplegable(JComboBox desplegable) {
		this.desplegable = desplegable;
	}
	
	
}
